<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>内部转账</title>
<link href="https://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
    <!--font-awesome.css?v=4.4.0-->
    <link href="https://cdn.staticfile.org/font-awesome/4.4.0/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <!--bootstrap.min.css-->
    <link href="https://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
    <!--custom.css-->
	<link rel="stylesheet" type="text/css" href="<%=basePath%>css/plugins/iCheck/custom.css"/>
	<link rel="stylesheet" href="<%=basePath%>js/plugins/layer/skin/layer.css" />
	<!--style.css-->
	<link rel="stylesheet" type="text/css" href="<%=basePath%>css/style.css"/>
</head>
<body>
<div class="col-md-10">
    <ol class="breadcrumb">
        <li>电子银行</li>
        <li class="active">内部转账</li>
    </ol>
    <br />
    <br />
    <!-- <span style="margin-left: 100px" class="">请输入会员姓名和密码</span> -->
  

    <!-- <form role="form" class="form-inline" style="margin-left: 100px">
    	<div class="form-group">
        	<label for="exampleInputEmail2" class="sr-only">用户名</label>
            	<input type="email" placeholder="请输入用户名" id="exampleInputEmail2" class="form-control">
        </div>
        <div class="form-group">
        	<label for="exampleInputPassword2" class="sr-only">密码</label>
            	<input type="password" placeholder="请输入密码" id="exampleInputPassword2" class="form-control">
        </div>
        <button type="button" class="btn btn-primary" >查询</button>
    </form>  -->
  
  <div class="ibox-content" style="margin-left: 100px;margin-top: 100px">
  	<form role="form" class="form-inline" action="" method="post">
  		<div class="form-group" style="margin-left: 100px">
  			<label for="exampleInputEmail2" class="sr-only">用户名</label>
  			<input type="email" placeholder="请输入用户名" id="name" name="name"  class="form-control">
 		</div>
  		<div class="form-group">
  			<label for="exampleInputPassword2" class="sr-only">密码</label>
  			<input type="password" placeholder="请输入密码" id="pwd" name="pwd"  class="form-control">
  		</div>
  		<button type="button" class="btn btn-primary" id="tijiao">确定</button>
  	</form>
  </div>
	<form class="form-horizontal m-t" id="moneyform" novalidate="novalidate" style="display: none" action="${pageContext.request.contextPath}/ZhuanZhangServlet/insert" method="post">
         <div class="form-group">
              <label class="col-sm-3 control-label">当前余额：</label>
                   <div class="col-sm-6">
                        <input value="" id="user_money" name="user_money" minlength="2" type="text" class="form-control" required="" aria-required="true">
                   </div>
           </div>
         <div class="form-group">
           	<label class="col-sm-3 control-label">充值金额：</label>
	            <div class="col-sm-6">
	         		<input id="money" type="text" class="form-control" name="money" required="" aria-required="true">
	         	</div>
	         	
         </div>
        
          <div class="form-group">
             <label class="col-sm-3 control-label">银行所在地址及支行详细名称：</label>
                 <div class="col-sm-6">
                     <input id="curl" type="url" class="form-control" name="url">
                 </div>
         </div>
         <div class="form-group">
             <label class="col-sm-3 control-label">银行名称：</label>
                  <div class="col-sm-6">
                  	<%-- <select name="bank"  class="form-control" style="width: 200px">
                       <c:forEach items="${bankList}" var="bank">
                            <option value="${bank.bank_name }">${bank.bank_name }</option>
                       </c:forEach>
                    </select> --%>
						 <input id="bank_name" type="url" class="form-control" name="bank_name">
                  </div>
         </div>
          <div class="form-group">
             <label class="col-sm-3 control-label">银行卡号：</label>
                  <div class="col-sm-6">
                       <input id="ccomment" name="comment" class="form-control" required="" aria-required="true">
             	  </div>
         </div>
         <input type="hidden" id="user" name="user" value="" />
         <input type="hidden" id="password" name="user_pass" value="" />
        <div class="form-group">
               <div class="col-sm-3 col-sm-offset-3" style="margin-left: 200px">
                     <input id="ti" class="btn btn-primary zhuanzhang" type="button" value="提交申请" />
               </div>
         </div>
    </form>
    
    <input type="hidden" name="" id="message" value="10" />
</div>

</body>
<!--jquery.min.js-->
<script src="https://cdn.staticfile.org/jquery/2.1.4/jquery.min.js"></script>
<!--bootstrap.min.js-->
<script src="https://cdn.bootcss.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<!--jquery.peity.min.js-->
<script src="<%=basePath%>js/plugins/peity/jquery.peity.min.js" type="text/javascript" charset="utf-8"></script>
<!--content.js-->
<script src="<%=basePath%>js/content.js" type="text/javascript" charset="utf-8"></script>
<!--icheck.min.js-->
<script src="<%=basePath%>js/plugins/iCheck/icheck.min.js" type="text/javascript" charset="utf-8"></script>
<!--peity-demo.js-->
<script src="<%=basePath%>js/demo/peity-demo.js" type="text/javascript" charset="utf-8"></script>
<!--layer.min.js-->
<script src="<%=basePath%>js/plugins/layer/layer.min.js" type="text/javascript" charset="utf-8"></script>
<script>	

layer.open({
	  title: '提现说明'
	  ,content: '您好，根据公司的充值规定，每日提交的账单，最迟24小时后到达，如果有账单未到达的情况请及时联系客服，另外，在转账的时候请自己核查自己的信息，避免出错的情况。 谢谢!'
	  ,area:['500px', '300px']
	  ,shade: [0.8, '#393D49'] 
	  ,anim: 5
	}); 
	
/* 获取值 */
$('#tijiao').click(function(){
	$.get('<%=basePath%>UsersServlet/findById',{"name":$('#name').val(),"pwd":$('#pwd').val()},function(data){
		if(data==0){
			layer.msg('密码错误',{icon: 5,offset:['180px','300px']},function(){
            	time:1000
            });
		}else{
			layer.open({
				type:1,
				title: '账户充值',
				content: $('#moneyform'),
				shade: [0.8, '#393D49'] ,
				area:['600px','400px'],
				offset:['30px','200px'],
				end:function(){
					
					if($('#message').val()==1){
		               layer.msg('转账成功',{icon: 1,offset:['180px','300px']},{
		                  	time:1000,
		                }); 
		               $('#message').val(10);
					}else if($('#message').val()==0){
						 layer.msg('转账失败',{
			                 time:1000,
			             }); 
						 $('#message').val(10);
					}else if($('#message').val()==2){
						 layer.msg('没有输入充值金额，充值失败',{icon: 3,offset:['180px','300px']},{
			                 time:1000,
			             }); 
						 $('#message').val(10);
					}
				}
				/* btn:['确定'],
				 yes: function(index, layero){
					 $.post('${pageContext.request.contextPath}/ZhuanZhangServlet/insert')
					 $('iframe').contents().find('#moneyform').submit();
					  layer.close(index);  //如果设定了yes回调，需进行手工关闭
				} */
			}); 
			var zhangMoney = JSON.parse(data);
			$('#user_money').val(zhangMoney[0].user_money);
			$('#ccomment').val(zhangMoney[0].user_cardNo);
			$('#curl').val(zhangMoney[0].user_address);
			$('#bank_name').val(zhangMoney[0].bank_name);
			$('#user').val(zhangMoney[0].user_name);
			$('#password').val(zhangMoney[0].user_pwd);
			
			
		}
		
	});
});


$('#ti').click(function(){
	$.get('<%=basePath%>ZhuanZhangServlet/insert',{
		"name":$('#user').val(),
		"user_pass":$('#password').val(),
		"user_money":$('#user_money').val(),
		"money":$('#money').val(),
		"url":$('#curl').val(),
		"bank_name":$('#bank_name').val(),
		"comment":$('#ccomment').val()
		},function (s) {
		 if(s==1){

               $('#message').val(1);
               layer.closeAll();
               
            }else if(s==0){
            	 $('#message').val(0);
                 layer.closeAll();
            }else{
            	 $('#message').val(2);
            	 layer.closeAll();
            }
    }); 
});
/*  $('button').click(function() {
	layer.open({
		type:1,
		title: '账户充值',
		content: $('#moneyform'),
		shade: [0.8, '#393D49'] ,
		area:['600px','400px'],
		offset:['30px','200px'],
		  yes: function(index, layero){
			 $.post('${pageContext.request.contextPath}/ZhuanZhangServlet/listALL')
			 $('iframe').contents().find('#commentForm').submit();
			  layer.close(index);  //如果设定了yes回调，需进行手工关闭
		}
	}); 
	
});  */
 
 


</script>
</html>